
import pygame

class Input(object):
    """
    TODO: Check list copying for memory efficiency
    Dependencies: PyGame
    """
    def __init__(self):
        pass
    
    def update(self):
        # Ensure we are getting the latest input information
        pygame.event.pump()
        # Store the new and old key states in lists
        #self.oldKeyStates = list(self.curKeyStates)
        self.curKeyStates = pygame.key.get_pressed()
        
    def keyIsDown(self, key):
        return self.curKeyStates[key]
    # TODO: Decide if these should be removed in favour of using events
    #def keyWasPressed(self, key):
    #    return False == self.oldKeyStates[key] and True == self.curKeyStates[key]
    #def keyWasReleased(self, key):
    #    return True == self.oldKeyStates[key] and False == self.curKeyStates[key]
    #def mouseButtonWasPressed(self, button):
    #    return pygame.mouse.get_pressed()[button]
    def mouseButtonIsDown(self, button):
        return pygame.mouse.get_pressed()[button]
    def getMousePos(self):
        return pygame.mouse.get_pos()
    def getMouseShift(self):
        return pygame.mouse.get_rel()
